<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
    <title>index.js</title>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <link rel="stylesheet" href="../../../../../../css/reset.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/main.css" type="text/css" media="screen" />
<link rel="stylesheet" href="../../../../../../css/github.css" type="text/css" media="screen" />
<script src="../../../../../../js/jquery-1.3.2.min.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/jquery-effect.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/main.js" type="text/javascript" charset="utf-8"></script>
<script src="../../../../../../js/highlight.pack.js" type="text/javascript" charset="utf-8"></script>

</head>

<body>
    <div class="banner">
        
        <h1>
            index.js
        </h1>
        <ul class="files">
            
            <li>
                lib/assets/javascripts/ruiqu_app/store_orders/index.js
                
            </li>
            <li>Last modified: 2017-01-30 17:13:35 +0800</li>
        </ul>
    </div>

    <div id="bodyContent">
        <div id="content">
  
    <div class="description">
      
<p>jQuery(function($){</p>

<pre><code>setDateTimePicker()

$(&quot;a.js-to-confirm&quot;).on(&quot;click&quot;, function(){
  var id = $(this).data(&quot;id&quot;);
  var _this = this
  var csrf = $(&quot;input#js-ruiqu-store-orders-index&quot;).val();
  $.ajax({
    url: &quot;/api/store_orders/&quot;+ id +&quot;/confirm&quot;,
    method: &quot;put&quot;,
    headers: {
      &#39;X-CSRF-Token&#39;: csrf
    },
    success: function(data){
      if(data.status){
        $(&quot;span.js-confirm-status-&quot;+ id).html(&quot;处理状态:&amp;nbsp已确认&quot;);
        $(_this).replaceWith(&quot;&lt;span&gt;订单确认&amp;nbsp&amp;nbsp&lt;/span&gt;&quot;)
      }
    }
  });
})

$(&quot;a.js-to-process&quot;).on(&quot;click&quot;, function(){
  var id = $(this).data(&quot;id&quot;);
  var _this = this
  var csrf = $(&quot;input#js-ruiqu-store-orders-index&quot;).val();
  $.ajax({
    url: &quot;/api/store_orders/&quot;+ id +&quot;/to_process&quot;,
    method: &quot;put&quot;,
    headers: {
      &#39;X-CSRF-Token&#39;: csrf
    },
    success: function(data){
      if(data.status){
        $(_this).siblings(&quot;a.js-to-mail&quot;).data(&quot;status&quot;, &quot;processing&quot;);
        $(_this).nextAll().last().replaceWith(&quot;&lt;span&gt;取消&lt;/span&gt;&quot;)
        $(_this).prev().replaceWith(&quot;&lt;span&gt;订单确认&amp;nbsp&amp;nbsp&lt;/span&gt;&quot;)
        $(_this).replaceWith(&quot;&lt;span&gt;处理订单&lt;/span&gt;&quot;)
        $(&quot;span.js-confirm-status-&quot;+ id).html(&quot;处理状态:&amp;nbsp处理中&quot;);
      }
    }
  });
})

$(&quot;a.js-to-mail&quot;).on(&quot;click&quot;, function(){
  console.log(this);
  var id = $(this).data(&quot;id&quot;);
  var status = $(this).data(&quot;status&quot;);
  var _this = this
  var csrf = $(&quot;input#js-ruiqu-store-orders-index&quot;).val();
  console.log(status);
  if (status == &quot;processing&quot;){
    $.ajax({
      url: &quot;/api/store_orders/&quot;+ id +&quot;/to_mail&quot;,
      method: &quot;put&quot;,
      headers: {
        &#39;X-CSRF-Token&#39;: csrf
      },
      success: function(data){
        if(data.status){
          $(_this).replaceWith(&quot;&lt;span&gt;确认发货&lt;/span&gt;&quot;)
          $(&quot;span.js-confirm-status-&quot;+ id).html(&quot;处理状态:&amp;nbsp已发货&quot;);
        }
      }
    });
  }else {
    BootstrapDialog.alert(&quot;请确定处理订单!&quot;);
  }
})

$(&quot;a.js-to-cancel&quot;).on(&quot;click&quot;, function(){
  var id = $(this).data(&quot;id&quot;);
  var _this = this
  var csrf = $(&quot;input#js-ruiqu-store-orders-index&quot;).val();
  $.ajax({
    url: &quot;/api/store_orders/&quot;+ id +&quot;/cancel&quot;,
    method: &quot;put&quot;,
    headers: {
      &#39;X-CSRF-Token&#39;: csrf
    },
    success: function(data){
      if(data.status){
        $(_this).siblings(&quot;a.js-to-confirm&quot;).replaceWith(&quot;&lt;span&gt;订单确认&amp;nbsp&amp;nbsp&lt;/span&gt;&quot;)
        $(_this).siblings(&quot;a.js-to-process&quot;).replaceWith(&quot;&lt;span&gt;处理订单&lt;/span&gt;&quot;)
        $(_this).siblings(&quot;a.js-to-mail&quot;).replaceWith(&quot;&lt;span&gt;确认发货&amp;nbsp&amp;nbsp&lt;/span&gt;&quot;)
        $(_this).replaceWith(&quot;&lt;span&gt;取消&lt;/span&gt;&quot;)
        $(&quot;span.js-confirm-status-&quot;+ id).html(&quot;处理状态:&amp;nbsp已取消&quot;);
      }
    }
  });
})</code></pre>

<p>})</p>

    </div>
  


  


  
  


  


  

  



  

    

    

    


    


    <!-- Methods -->
              </div>

    </div>
  </body>
</html>
